package models

type CreateApprovalTemplateRequest struct {
	Name  string                        `json:"name" form:"name"`
	Nodes []CreateApprovalTemplateNodes `json:"nodes" form:"nodes"`
}

type CreateApprovalTemplateNodes struct {
	Name           string `json:"name" form:"name"`
	Sort           int    `json:"sort" form:"sort"`
	ApprovalUserId int    `json:"approvalUserId" form:"approvalUserId"`
}

// 审批模版
type ApprovalTemplate struct {
	ModelBase
	Code string `json:"code" form:"code" gorm:"column:code;type:varchar(255);not null;comment:审批模版编码"`
	Name string `json:"name" form:"name" gorm:"column:name;type:varchar(255);not null;comment:审批模版"`
}

func (ApprovalTemplate) TableName() string {
	return "approval_template"
}

// 审批模版节点
type ApprovalTemplateNodes struct {
	ModelBase
	Name           string `json:"name" form:"name" gorm:"column:name;type:varchar(255);not null;comment:审批模版"`
	TemplateId     int    `json:"templateId" form:"templateId" gorm:"type:int(11);"`         // 模版Id
	Sort           int    `json:"sort" form:"sort" gorm:"type:int(11);"`                     // 排序
	ApprovalUserId int    `json:"approvalUserId" form:"approvalUserId" gorm:"type:int(11);"` // 审批人Id
}

func (ApprovalTemplateNodes) TableName() string {
	return "approval_template_nodes"
}

// 发起审批
type ApprovalProcess struct {
	ModelBase
	TemplateId   int    `json:"templateId" form:"templateId" gorm:"type:int(11);"`          // 模版Id
	TemplateName string `json:"templateName" form:"templateName" gorm:"type:varchar(255);"` // 模版名称
	Status       int    `json:"status" form:"status" gorm:"type:int(11);"`                  // 状态 审批中/审批已通过/审批已拒绝
	CreateUserId int    `json:"createUserId" form:"createUserId" gorm:"type:int(11);"`      // 审批人Id
}

func (ApprovalProcess) TableName() string {
	return "approval_process"
}

// 发起审批节点
type ApprovalProcessNodes struct {
	ModelBase
	TemplateId       int    `json:"templateId" form:"templateId" gorm:"type:int(11);"`                  // 模版Id
	NodeId           int    `json:"nodeId" form:"nodeId" gorm:"type:int(11);"`                          // 节点Id
	NodeName         string `json:"nodeName" form:"nodeName" gorm:"type:varchar(255);"`                 // 节点名称
	Sort             int    `json:"sort" form:"sort" gorm:"type:int(11);"`                              // 排序
	ApprovalUserId   int    `json:"approvalUserId" form:"approvalUserId" gorm:"type:int(11);"`          // 审批人Id
	ApprovalUserName string `json:"approvalUserName" form:"approvalUserName" gorm:"type:varchar(255);"` // 审批人名称
	Status           int    `json:"status" form:"status" gorm:"type:int(11);"`                          // 状态 审批中/审批已通过/审批已拒绝
	Remark           string `json:"remark" form:"remark" gorm:"type:varchar(255);"`                     // 备注
}

func (ApprovalProcessNodes) TableName() string {
	return "approval_process_nodes"
}
